#include <cstdio>
#include <cstring>
int v[11], w[11], f[101], n;
int main() {
	for (int i = 1; i <= 10; ++i) v[i] = i, scanf("%d", &w[i]);
	scanf("%d", &n);
    memset(f, 127, sizeof f);
    f[0] = 0;
	for (int i = 1; i <= 10; ++i) 
        for (int j = v[i]; j <= n; ++j) 
            f[j] = f[j] > (f[j - v[i]] + w[i]) ? (f[j - v[i]] + w[i]) : f[j];
    printf("%d\n", f[n]);
    return 0;
}